package com.example;

import java.io.IOException;
import javax.servlet.http.*;

@SuppressWarnings("serial")
public class HelloSOAPClientServlet extends HttpServlet {
	public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
		  String name = req.getParameter("name");
		  boolean isArriving = Boolean.parseBoolean(req.getParameter("arriving"));
		  resp.setContentType("text/plain");
		  Greeter greeter = new GreeterService().getGreeterPort();
		  String message;
		  if (isArriving){
		    message = greeter.sayHello(name);
		  }
		  else {
		    message = greeter.sayGoodbye(name);
		  }
		  resp.getWriter().println(message);
		}
}
